LASAFT-Net-v2 light¶
LASAFT-Net-v2 Light version for MDX Challenge
Preliminaries¶
# preliminaries: install python3-dev
!pip install hydra-core==1.1.0.rc1 pytorch-lightning>=1.4.1 rich wandb
!git clone https://github.com/ws-choi/LASAFT-Net-v2 --quiet
%cd LASAFT-Net-v2
/home/wschoi/LASAFT-Net-v2/book/quickstart/LASAFT-Net-v2
Load Mixture Track¶
import soundfile as sf
from IPython.display import display, Audio
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
print('Track info: Feel this breeze - (Prod. JoeSwan) - HyungWoo & Sunmin')
mixture, _ = sf.read('data/test/sample/mixture.wav')
display(Audio(mixture.T, rate=44100))
Track info: Feel this breeze - (Prod. JoeSwan) - HyungWoo & Sunmin
Load the pretrained model¶
from load_pretrained import get_mdx_light_v2_699
model = get_mdx_light_v2_699()
checkpoint conf/pretrained/v2_light/epoch=669.ckpt is loaded:
Separate sources with LASAFT-Net-V2¶
result = model.separate_tracks(mixture, ['vocals', 'drums', 'bass', 'other'], overlap_ratio=0.5, batch_size=4)
/home/wschoi/exit/envs/tutorial-environment/lib/python3.9/site-packages/torch/functional.py:545: UserWarning: istft will require a complex-valued input tensor in a future PyTorch release. Matching the output from stft with return_complex=True. (Triggered internally at ../aten/src/ATen/native/SpectralOps.cpp:817.)
return _VF.istft(input, n_fft, hop_length, win_length, window, center, # type: ignore[attr-defined]
print('separated vocals:')
display(Audio(result['vocals'].T, rate=44100))
separated vocals:
print('separated drums:')
display(Audio(result['drums'].T, rate=44100))
separated drums:
print('separated bass:')
display(Audio(result['bass'].T, rate=44100))
separated bass:
print('separated other:')
display(Audio(result['other'].T, rate=44100))
separated other:
%cd ..
%rm -rf LASAFT-Net-v2
/home/wschoi/LASAFT-Net-v2/book/quickstart